package com.springboot.log;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LogController implements ApplicationContextAware {
    private ApplicationContext applicationContext;

    @GetMapping("/test")
    public boolean test() {
        System.out.println("sdfsdfsdf");
        applicationContext.publishEvent(new DemoEvent(this));
        return true;
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }
}
